import React from 'react';
import { Button, Table, Space } from 'antd';


const UserList = (props) => {
    const {dataSource = [], deleteDemo} = props;
    console.log('组建数据props', props);
    const columns = [
        {
            title: '姓名',
            dataIndex: 'name',
            key: 'name',
        },
        {
            title: '年龄',
            dataIndex: 'age',
            key: 'age',
        },
        {
            title: '住址',
            dataIndex: 'address',
            key: 'address',
        },
        {
            title: '操作',
            dataIndex: 'action',
            key: 'delete',
            render:(_, record) => (
                <Space size="middle">
                    <Button onClick={() => deleteDemo(record)}>Delete</Button>
                </Space>
            )
        },
    ]
    return (
        <Table dataSource={dataSource} columns={columns} />
    )
}

export default React.memo(UserList);